import hyRequest from '../index'
import { IAccount, IDataType, ILoginResult, ILoginUserInfo } from './types'
enum LoginAPI {
  AccountLogin = '/login',
  AccountUserInfo = '/users/',
  AccountUserMenus = '/role/'
}
// 用户登录
export function accountLoginRequest(account: IAccount) {
  return hyRequest.post<IDataType<ILoginResult>>({
    url: LoginAPI.AccountLogin,
    data: account
  })
}
// 用户信息
export function accountLoginUserInfo(id: number) {
  return hyRequest.get<IDataType<ILoginUserInfo>>({
    url: LoginAPI.AccountUserInfo + id,
    showLoading: false
  })
}
// 用户菜单
export function accountLoginMenusById(id: number) {
  return hyRequest.get<IDataType>({
    url: LoginAPI.AccountUserMenus + id + '/menu',
    showLoading: false
  })
}
